package shuogg.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;

import shuogg.domain.User;


@SuppressWarnings("deprecation")
public class CommandController extends AbstractCommandController {
    // 指定参数绑定到那个javaBean
    public CommandController() {
        this.setCommandClass(User.class);
    }

    @Override
    protected ModelAndView handle(HttpServletRequest arg0, HttpServletResponse arg1, Object command, BindException arg3)
            throws Exception {
        User myuserData = (User) command;
        ModelAndView mv = new ModelAndView();
        mv.addObject("myuserData", myuserData);
        mv.setViewName("showResult");
        return mv;
    }

    @Override
    protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
        super.initBinder(request, binder);
    }

}
